package zuoy2;

public class Task1 {

    private String name;

    private int age;

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Task1() {

    }

    public Task1(String name) {
        this.setName(name);
    }

    public Task1(int age) {
        this.setAge(age);
    }

    public Task1(String name, int age) {
        this(name);
        this.setAge(age);
    }

    public int getNameLength() {
        if (this.name != null) {
            return this.name.length();
        } else {
            return 0;
        }
    }

    public int getAge() {
        return this.age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public char getFirstCharacter() {
        if ((this.name != null) && (this.name.length() > 0)) {
            return this.name.toCharArray()[0];
        } else {
            return 0;
        }
    }
}